package hk.meiyan.com.kotlincode.young

import android.widget.TextView
import hk.meiyan.com.kotlincode.okhttp.OkCallBack
import okhttp3.Call
import okhttp3.Response
import java.io.IOException

/**
 * Created by 54hk on 2018/5/25.
 */
class YCallBack private constructor(mText:TextView) : OkCallBack{

    var mText:TextView? = mText
    companion object {
        var yCallBack:YCallBack?= null
       fun getIndance(c:TextView): YCallBack{
           if(yCallBack == null){
               synchronized(YCallBack ::class){
                   if(yCallBack == null){
                       yCallBack = YCallBack(c)
                   }
               }
           }
           return  yCallBack!!
       }
    }
    override fun onFailure(call: Call?, e: IOException?) {
    }
    override fun onResponse(call: Call?, response: Response?) {

    }
    override fun onFailure() {
        mText?.setText("哎呦不错   onResponse")
    }


}